package com.mentaleye.dal.dao.mybatis;

import com.mentaleye.dal.dao.AutoFormDao;
import com.mentaleye.dal.model.AutoFormExample;
import com.mentaleye.dal.model.AutoFormWithBLOBs;
import com.mentaleye.dal.service.AutoFormMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class AutoFormDaoImpl extends BaseDao
  implements AutoFormDao
{

  @Autowired
  AutoFormMapper autoFormMapper;

  public boolean addForm(AutoFormWithBLOBs autoForm)
  {
    return getResultByInt(this.autoFormMapper.insertSelective(autoForm));
  }


  public List<Map<String, Object>> selectByMap(Map<String, Object> map)
  {
    return this.autoFormMapper.selectByMap(map);
  }

  public AutoFormWithBLOBs getFormById(Integer id, Integer version)
  {
    return this.autoFormMapper.getFormById(id, version);
  }

  public boolean addFormByLast(AutoFormWithBLOBs autoForm)
  {
    return getResultByInt(this.autoFormMapper.addFormByLast(autoForm));
  }

  public boolean editForm(AutoFormWithBLOBs autoForm, AutoFormExample example)
  {
    return getResultByInt(this.autoFormMapper.updateByExampleSelective(autoForm, example));
  }
}